package com.aqie.meet.ui.login;

import android.content.Intent;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;

import com.aqie.libcommon.app.BaseActivity;
import com.aqie.libcommon.app.BaseApplication;
import com.aqie.meet.R;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 用户名
 */
public class Reg2Activity extends BaseActivity {

    @BindView(R.id.bt_next)
    Button mButtonNext;

    @BindView(R.id.et_name)
    EditText mName;

    private String code;
    private String phone;

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_reg2;
    }

    @Override
    protected void initData() {
        super.initData();
        Intent intent = getIntent();
        phone = intent.getStringExtra("phone");
        code = intent.getStringExtra("code");
    }

    @OnClick(R.id.bt_next)
    void next(){
        String name = mName.getText().toString();
        if (TextUtils.isEmpty(mName.getText().toString())) {
            showError("用户名不能为空！");
            return;
        }
        Intent intent = new Intent(this, Reg3Activity.class);
        intent.putExtra("username", name);
        intent.putExtra("phone", phone);
        intent.putExtra("code", code);
        startActivity(intent);
    }

    public void showError(String errMsg) {
        BaseApplication.showToast(errMsg);
        mButtonNext.setEnabled(true);
    }

}